package ftp;

import info.FtpInfo;

import java.io.File;
import java.io.IOException;

import org.jibble.simpleftp.SimpleFTP;

public class FtpCon
{
	private FtpInfo info;
	private String path;
	private SimpleFTP ftp;

	public FtpCon(FtpInfo info, String path)
	{
		this.info = info;
		this.path = path;
		ftp = new SimpleFTP();
	}

	public void makeConnection() throws IOException
	{
		ftp.connect(info.getUrl(), info.getPort(), info.getUser(), info.getPassword());
	}

	public void uploadFile() throws IOException
	{
		ftp.stor(new File(path));
	}

	public void closeConnection()
	{
		try
		{
			ftp.disconnect();
		}
		catch(Exception e){};
	}
}
